/**
 * 
 */
package kr.co.goodwilldd;

import java.io.File;

/**
 * @author IN-SOFT Inc. GoodwillDD(sylee@in-soft.co.kr)
 * 
 */
public class FileModel {
	final String replacePath;
	
	public FileModel(final String replacePath) {
		this.replacePath = replacePath;
	}

	public FileModel(final String replacePath, File file) {
		this.replacePath = replacePath;
		this.file = file;
		this.path = file
				.getAbsolutePath()
				.replace(replacePath, "")
				.replace("\\", "/").replace(file.getName(), "");
		this.filename = file.getName();
		this.size = file.length();
		this.lastModified = CheckSumUtil.convertLongToDate(file.lastModified());
	}

	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append(path.replace(
				replacePath, "")
				.replace("\\", "/"));
		builder.append("\t");
		builder.append(filename);
		builder.append("\t");
		builder.append(checksum);
		builder.append("\t");
		builder.append(size);
		builder.append("\t");
		builder.append(lastModified);
		return builder.toString();
	}

	File file;
	String path;
	String filename;
	long size;
	String lastModified;
	String checksum;

	/**
	 * @return the path
	 */
	public String getPath() {
		return path;
	}

	/**
	 * @param path
	 *            the path to set
	 */
	public void setPath(String path) {
		this.path = path;
	}

	/**
	 * @return the filename
	 */
	public String getFilename() {
		return filename;
	}

	/**
	 * @param filename
	 *            the filename to set
	 */
	public void setFilename(String filename) {
		this.filename = filename;
	}

	/**
	 * @return the size
	 */
	public long getSize() {
		return size;
	}

	/**
	 * @param size
	 *            the size to set
	 */
	public void setSize(long size) {
		this.size = size;
	}

	/**
	 * @return the file
	 */
	public File getFile() {
		return file;
	}

	/**
	 * @param file
	 *            the file to set
	 */
	public void setFile(File file) {
		this.file = file;
	}

	/**
	 * @return the lastModified
	 */
	public String getLastModified() {
		return lastModified;
	}

	/**
	 * @param lastModified
	 *            the lastModified to set
	 */
	public void setLastModified(String lastModified) {
		this.lastModified = lastModified;
	}

	/**
	 * @return the checksum
	 */
	public String getChecksum() {
		return checksum;
	}

	/**
	 * @param checksum the checksum to set
	 */
	public void setChecksum(String checksum) {
		this.checksum = checksum;
	}
}
